<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QAbstractTableModel Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QAbstractTableModel Class Reference<br /><sup><sup>[<a href="qtcore.html">QtCore</a> module]</sup></sup></h1><p>The QAbstractTableModel class provides an abstract model that
can be subclassed to create table models. <a href="#details">More...</a></p>

<p>Inherits <a href="qabstractitemmodel.html">QAbstractItemModel</a>.</p><p>Inherited by <a href="qsqlquerymodel.html">QSqlQueryModel</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qabstracttablemodel.html#QAbstractTableModel">__init__</a></b> (<i>self</i>, QObject&#160;<i>parent</i>&#160;=&#160;None)</li><li><div class="fn" />bool <b><a href="qabstracttablemodel.html#dropMimeData">dropMimeData</a></b> (<i>self</i>, QMimeData&#160;<i>data</i>, Qt.DropAction&#160;<i>action</i>, int&#160;<i>row</i>, int&#160;<i>column</i>, QModelIndex&#160;<i>parent</i>)</li><li><div class="fn" />QModelIndex <b><a href="qabstracttablemodel.html#index">index</a></b> (<i>self</i>, int&#160;<i>row</i>, int&#160;<i>column</i>, QModelIndex&#160;<i>parent</i>&#160;=&#160;QModelIndex())</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QAbstractTableModel class provides an abstract model that
can be subclassed to create table models.</p>
<p>QAbstractTableModel provides a standard interface for models
that represent their data as a two-dimensional array of items. It
is not used directly, but must be subclassed.</p>
<p>Since the model provides a more specialized interface than
<a href="qabstractitemmodel.html">QAbstractItemModel</a>, it is not
suitable for use with tree views, although it can be used to
provide data to a <a href="qlistview.html">QListView</a>. If you
need to represent a simple list of items, and only need a model to
contain a single column of data, subclassing the <a href="qabstractlistmodel.html">QAbstractListModel</a> may be more
appropriate.</p>
<p>The <a href="qabstractitemmodel.html#rowCount">rowCount</a>()
and <a href="qabstractitemmodel.html#columnCount">columnCount</a>()
functions return the dimensions of the table. To retrieve a model
index corresponding to an item in the model, use <a href="qabstracttablemodel.html#index">index</a>() and provide only the
row and column numbers.</p>
<a id="subclassing" name="subclassing" />
<h3>Subclassing</h3>
<p>When subclassing QAbstractTableModel, you must implement
<a href="qabstractitemmodel.html#rowCount">rowCount</a>(), <a href="qabstractitemmodel.html#columnCount">columnCount</a>(), and
<a href="qabstractitemmodel.html#data">data</a>(). Default
implementations of the <a href="qabstracttablemodel.html#index">index</a>() and <a href="qabstractitemmodel.html#parent">parent</a>() functions are
provided by QAbstractTableModel. Well behaved models will also
implement <a href="qabstractitemmodel.html#headerData">headerData</a>().</p>
<p>Editable models need to implement <a href="qabstractitemmodel.html#setData">setData</a>(), and implement
<a href="qabstractitemmodel.html#flags">flags</a>() to return a
value containing <a href="qt.html#ItemFlag-enum">Qt.ItemIsEditable</a>.</p>
<p>Models that provide interfaces to resizable data structures can
provide implementations of <a href="qabstractitemmodel.html#insertRows">insertRows</a>(), <a href="qabstractitemmodel.html#removeRows">removeRows</a>(), <a href="qabstractitemmodel.html#insertColumns">insertColumns</a>(), and
<a href="qabstractitemmodel.html#removeColumns">removeColumns</a>(). When
implementing these functions, it is important to call the
appropriate functions so that all connected views are aware of any
changes:</p>
<ul>
<li>An <a href="qabstractitemmodel.html#insertRows">insertRows</a>()
implementation must call <a href="qabstractitemmodel.html#beginInsertRows">beginInsertRows</a>()
<i>before</i> inserting new rows into the data structure, and it
must call <a href="qabstractitemmodel.html#endInsertRows">endInsertRows</a>()
<i>immediately afterwards</i>.</li>
<li>An <a href="qabstractitemmodel.html#insertColumns">insertColumns</a>()
implementation must call <a href="qabstractitemmodel.html#beginInsertColumns">beginInsertColumns</a>()
<i>before</i> inserting new columns into the data structure, and it
must call <a href="qabstractitemmodel.html#endInsertColumns">endInsertColumns</a>()
<i>immediately afterwards</i>.</li>
<li>A <a href="qabstractitemmodel.html#removeRows">removeRows</a>()
implementation must call <a href="qabstractitemmodel.html#beginRemoveRows">beginRemoveRows</a>()
<i>before</i> the rows are removed from the data structure, and it
must call <a href="qabstractitemmodel.html#endRemoveRows">endRemoveRows</a>()
<i>immediately afterwards</i>.</li>
<li>A <a href="qabstractitemmodel.html#removeColumns">removeColumns</a>()
implementation must call <a href="qabstractitemmodel.html#beginRemoveColumns">beginRemoveColumns</a>()
<i>before</i> the columns are removed from the data structure, and
it must call <a href="qabstractitemmodel.html#endRemoveColumns">endRemoveColumns</a>()
<i>immediately afterwards</i>.</li>
</ul>
<p><b>Note:</b> Some general guidelines for subclassing models are
available in the <a href="model-view-programming.html#model-subclassing-reference">Model
Subclassing Reference</a>.</p>
<p><b>Note:</b></p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QAbstractTableModel" />QAbstractTableModel.__init__ (<i>self</i>, <a href="qobject.html">QObject</a>&#160;<i>parent</i>&#160;=&#160;None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs an abstract table model for the given
<i>parent</i>.</p>


<h3 class="fn"><a name="dropMimeData" />bool QAbstractTableModel.dropMimeData (<i>self</i>, <a href="qmimedata.html">QMimeData</a>&#160;<i>data</i>, <a href="qt.html#DropAction-enum">Qt.DropAction</a>&#160;<i>action</i>, int&#160;<i>row</i>, int&#160;<i>column</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>parent</i>)</h3><p>Reimplemented from <a href="qabstractitemmodel.html#dropMimeData">QAbstractItemModel.dropMimeData</a>().</p>


<h3 class="fn"><a name="index" /><a href="qmodelindex.html">QModelIndex</a> QAbstractTableModel.index (<i>self</i>, int&#160;<i>row</i>, int&#160;<i>column</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>parent</i>&#160;=&#160;QModelIndex())</h3><p>Reimplemented from <a href="qabstractitemmodel.html#index">QAbstractItemModel.index</a>().</p>
<p>Returns the index of the data in <i>row</i> and <i>column</i>
with <i>parent</i>.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#parent">parent</a>().</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.9.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2011</td><td align="right" width="25%">Qt&#160;4.8.0</td></tr></table></div></address></body></html>